package ui.robots_wicket;

import org.apache.wicket.ajax.AjaxRequestTarget;
import org.apache.wicket.ajax.markup.html.form.AjaxButton;
import org.apache.wicket.markup.html.form.Form;
import org.uqbar.commons.model.UserException;

public abstract class AjaxButtonCopado extends AjaxButton {

	
	public AjaxButtonCopado(String id) {
		super(id);
	}

	private static final long serialVersionUID = 1L;

	public void onSubmit(AjaxRequestTarget target, Form<?> form) {

		try {
			this.execute(target, form);
		} catch (UserException e) {
			this.error(e.getMessage());
		}
	}
	

	public abstract void execute(AjaxRequestTarget target, Form<?> form);
}
